<template>
    <vol-edit ref="edit"
              :keyField="options.key"
              :tableName="options.tableName"
              :tableCNName="options.tableCNName"
              :labelWidth="100"
              :formFields="options.editFormFields"
              :formOptions="options.editFormOptions"
              :detail="options.detail"
              @initButtons="initButtons"
              @initDetailButtons="initDetailButtons"></vol-edit>
</template>
<script>
    import { defineComponent, ref, reactive, getCurrentInstance } from 'vue';
    import { useRouter, useRoute } from 'vue-router';
    import store from '@/store/index';
    import http from '@/api/http.js';
    import editOptions from './options.js';
    //参数传递与方法实现，看VolEdit.vue文件
    export default defineComponent({
        setup(props, context) {
            //vol-edit组件
            const edit = ref(null);

            const options = reactive({
                //表单字段
                editFormFields: {},
                //表单配置
                editFormOptions: [],
                //明细表信息
                detail: {
                    cnName: '',
                    table: '',
                    url: '',
                    columns: [],
                    sortName: '',
                    key: ''
                },
                details:[]
            });
            Object.assign(options, editOptions());

            //初始化主表按钮
            const initButtons = (buttons) => { };
            //初始化明细表按钮
            const initDetailButtons = (buttons) => { };

            return { edit, options, initButtons, initDetailButtons };
        },
        /****************************************/
        //这里是vue2语法,不想写vue3语法就在这里写vue2
        data() {
            return {};
        },
        methods: {},
        created() {
            //this.options
        }
    });
</script>
